package 
{
	import flash.display.Sprite;
	import flash.events.Event;
	
	/**
	 * This class acts as the entry point to our game.
	 */
	public class Main extends Sprite 
	{
		
		/**
		 * Called automatically when the swf loads.
		 */
		public function Main():void 
		{
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		/**
		 * Initialize everything.
		 * @param	e	the event that calls this.
		 */
		private function init(e:Event = null):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			
			var game:Game = new Game();
			addChild(game);
			game.init();
			
			addEventListener(Event.ENTER_FRAME, game.onEnterFrame);
			
			// TODO: Register more event listeners.
		}
		
	}
	
}